function http(url,data,method){
  return new Promise((resolve,reject)=>{
    wx.showLoading({
      title: '加载中...',
    })
    wx.request({
      url,
      data,
      method: method || 'get',
      success:function(res){
        resolve(res)
      },
      fail:function(err){
        reject(err)
      },
      complete:function(res){
        wx.hideLoading()
      }
    })
  })
}

module.exports =http;